package org.nidy.erp.aop;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;

@Slf4j
//@Component
//@Aspect

public class RecordTimeAspect {
    @Around("execution(* org.nidy.erp.service.impl.*.*(..))")
    public Object recordTime(ProceedingJoinPoint joinPoint) throws Throwable {
        long start = System.currentTimeMillis();
        Object result = joinPoint.proceed();
        long end=System.currentTimeMillis();
        log.info("{} executed in {} ms",joinPoint,end-start);
        return result;
    }
}
